package zhaomh.zhlib;

import net.fabricmc.api.ClientModInitializer;

import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientLifecycleEvents;
import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientTickEvents;
import net.fabricmc.fabric.api.client.keybinding.v1.KeyBindingHelper;
import net.minecraft.client.option.KeyBinding;
import net.minecraft.client.util.InputUtil;
import org.lwjgl.glfw.GLFW;


public class ZhLibClient implements ClientModInitializer, ModInstance {

    @Override
    public void onInitializeClient() {
        ClientLifecycleEvents.CLIENT_STOPPING.register(mc->{
            ZhLib.LOGGER.info("game stop -> ...");
        });
        KeyBinding keyBinding = KeyBindingHelper.registerKeyBinding(new KeyBinding(
                "zhlib.testname",
                InputUtil.Type.KEYSYM,
                GLFW.GLFW_KEY_L,
                "zhlib.test"
        ));
        ClientTickEvents.END_CLIENT_TICK.register(client -> {
            while (keyBinding.wasPressed()) {
                mc.setScreen(test.getTestConfigScreen());
            }
        });}
}
